package com.jason.quectel.utils;

import java.io.IOException;

import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**
 * @author：Jason
 * @date：2022/3/9 18:56
 * @email：1129847330@qq.com
 * @description:
 */
public class OkHttpUtils {

    public static Response get(String address) throws IOException {
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = new Request.Builder().url(address).build();
        return okHttpClient.newCall(request).execute();
    }

    public static void get(String address, Callback callback) {
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = new Request.Builder().url(address).build();
        okHttpClient.newCall(request).enqueue(callback);
    }
}